package com.roc.web.action.windcontroll;

import java.util.ArrayList;
import java.util.List;

import com.roc.page.BaseSearchCondition;
import com.roc.page.WhereHQLFieldBean;
import com.roc.util.Constance;

public class OrderProcessSearchCondition extends BaseSearchCondition{
	private String mchtCd;//商户号
	private String accountNo;//账号
	private String minDate;//清算交易日期
	private String maxDate;
	private String orderType;//调单类型
	private String reasonCd;//原因码

	
	
	@Override
	protected List<WhereHQLFieldBean> getWhereHQLFieldBeanList() {
		List<WhereHQLFieldBean> filedBeanList = new ArrayList<WhereHQLFieldBean>();
		String ordType="";
		if(!"".equals(orderType)&&orderType!=null){
			if("1000".equals(orderType.trim())){ordType="T.firstQuery";}
			else if("1001".equals(orderType.trim())){ordType="T.secondQuery";}
			else if("1002".equals(orderType.trim())){ordType="T.firstSurvey";}
			else if("1003".equals(orderType.trim())){ordType="T.secondSurvey";}
			else if("1004".equals(orderType.trim())){ordType="T.loanAdjust";}
			else if("1005".equals(orderType.trim())){ordType="T.firstWithdrawCash";}
			else if("1006".equals(orderType.trim())){ordType="T.firstChargeBack";}
			else if("1007".equals(orderType.trim())){ordType="T.secondWithDrawCash";}
			else if("1008".equals(orderType.trim())){ordType="T.secondChargeBack";}
			else if("1009".equals(orderType.trim())){ordType="T.exceptionNegotiate";}
			else if("1010".equals(orderType.trim())){ordType="T.exceptionLongMoney";}
			else if("1011".equals(orderType.trim())){ordType="T.collectionWithDrawCash";}
			else if("1012".equals(orderType.trim())){ordType="T.collectionNegotiate";}
		}
		if(Constance.isNotEmpty(mchtCd)){
			filedBeanList.add(new WhereHQLFieldBean("T.merchantNo", mchtCd.trim(),"=", false));
		}
		
		if(Constance.isNotEmpty(accountNo)){
			filedBeanList.add(new WhereHQLFieldBean("T.accountNo", accountNo.trim(),"=", false));
		}
		
		if(Constance.isNotEmpty(minDate)){
			filedBeanList.add(new WhereHQLFieldBean("T.transDate", minDate.trim(),">=", false));
		}
		
		if(Constance.isNotEmpty(maxDate)){
			filedBeanList.add(new WhereHQLFieldBean("T.transDate", maxDate.trim(),"<=", false));
		}
		if(Constance.isNotEmpty(orderType)){	
				filedBeanList.add(new WhereHQLFieldBean("   "+ordType+"  is not null "));
		}
		
		if(Constance.isNotEmpty(reasonCd)){
			filedBeanList.add(new WhereHQLFieldBean(ordType, reasonCd.trim(),"=", false));
		}
		
		return filedBeanList;
	}

	@Override
	protected String getRowCountHQL() {
		String sql ="SELECT COUNT(*) FROM RiskSurveyOrder T WHERE 1=1";
		
		return sql;
	}

	@Override
	protected String getSearchHQL() {
		
		String hql ="FROM RiskSurveyOrder T WHERE 1=1";
	    return hql;
	}

	@Override
	protected String getOrderPartOfHQL() {
		// TODO Auto-generated method stub
		return "ORDER BY T.id";
	}

	public String getMchtCd() {
		return mchtCd;
	}

	public void setMchtCd(String mchtCd) {
		this.mchtCd = mchtCd;
	}

	public String getAccountNo() {
		return accountNo;
	}

	public void setAccountNo(String accountNo) {
		this.accountNo = accountNo;
	}

	public String getReasonCd() {
		return reasonCd;
	}

	public void setReasonCd(String reasonCd) {
		this.reasonCd = reasonCd;
	}

	public String getMinDate() {
		return minDate;
	}

	public void setMinDate(String minDate) {
		this.minDate = minDate;
	}

	public String getMaxDate() {
		return maxDate;
	}

	public void setMaxDate(String maxDate) {
		this.maxDate = maxDate;
	}

	public String getOrderType() {
		return orderType;
	}

	public void setOrderType(String orderType) {
		this.orderType = orderType;
	}
	
	
	

}







